﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Upreader.Usenet.Nntp
{
    public interface INntpClient
    {
        #region Properties

        /// <summary>
        /// Get or set a timeout for the connection
        /// </summary>
        int ConnectionTimeout { get; set; }

        /// <summary>
        /// Get or set the address of the server as a string
        /// </summary>
        string Address { get; set; }

        /// <summary>
        /// Get or set the port of the server to connect to
        /// </summary>
        int Port { get; set; }

        /// <summary>
        /// Get or set wether the connection is a secured connection
        /// </summary>
        bool IsSecuredConnection { get; set; }

        /// <summary>
        /// Get or set authentication info for the socket
        /// </summary>
        NntpClientAuthentication Authentication { get; set; }

        /// <summary>
        /// Get wether the socket is connected
        /// </summary>
        bool IsOpen { get; }

        /// <summary>
        /// Get recorded statistics for this client
        /// </summary>
        NntpClientStatistics Statistics { get; }

        #endregion // Properties

        #region Methods

        /// <summary>
        /// Opens a connection
        /// </summary>
        void Open();

        /// <summary>
        /// Closes the connection and all underlying resources
        /// </summary>
        void Close();

        /// <summary>
        /// Selects the group specified making it the active group over the connection
        /// </summary>
        /// <param name="groupName">The name of the group to make active</param>
        /// <returns>Information about the newsgroup</returns>
        NewsGroup SelectNewsGroup(string groupName);

        /// <summary>
        /// Creates a stream usuable for reading the article's body.
        /// </summary>
        Stream GetArticleBodyStream(string articleId);

        /// <summary>
        /// Get the text containing help
        /// </summary>
        string GetHelpText();

        #endregion // Methods
    }
}
